package com.ruoyi.chat.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.chat.mapper.ChatMapper;
import com.ruoyi.chat.domain.Chat;
import com.ruoyi.chat.service.IChatService;

/**
 * chatService业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-22
 */
@Service
public class ChatServiceImpl implements IChatService 
{
    @Autowired
    private ChatMapper chatMapper;

    /**
     * 查询chat
     * 
     * @param menuId chat主键
     * @return chat
     */
    @Override
    public Chat selectChatByMenuId(Long menuId)
    {
        return chatMapper.selectChatByMenuId(menuId);
    }

    /**
     * 查询chat列表
     * 
     * @param chat chat
     * @return chat
     */
    @Override
    public List<Chat> selectChatList(Chat chat)
    {
        return chatMapper.selectChatList(chat);
    }

    /**
     * 新增chat
     * 
     * @param chat chat
     * @return 结果
     */
    @Override
    public int insertChat(Chat chat)
    {
        chat.setCreateTime(DateUtils.getNowDate());
        return chatMapper.insertChat(chat);
    }

    /**
     * 修改chat
     * 
     * @param chat chat
     * @return 结果
     */
    @Override
    public int updateChat(Chat chat)
    {
        chat.setUpdateTime(DateUtils.getNowDate());
        return chatMapper.updateChat(chat);
    }

    /**
     * 批量删除chat
     * 
     * @param menuIds 需要删除的chat主键
     * @return 结果
     */
    @Override
    public int deleteChatByMenuIds(Long[] menuIds)
    {
        return chatMapper.deleteChatByMenuIds(menuIds);
    }

    /**
     * 删除chat信息
     * 
     * @param menuId chat主键
     * @return 结果
     */
    @Override
    public int deleteChatByMenuId(Long menuId)
    {
        return chatMapper.deleteChatByMenuId(menuId);
    }
}
